/**
 * Copyright (C), 2017-2019, 云南慧天
 * FileName: ResultGenerator
 * Author:   Wuyongsheng
 * Date:     2019/7/17 21:43
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.dingwen.minser.result;


import java.sql.Timestamp;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author Wuyongsheng
 * @create 2019/7/17
 * @since 1.0.0
 */
public class ResultGenerator {
    private static final String DEFAULT_OK = "OK";

    public static Result genOkResult() {
        return new Result()
                .setCode(ResultCode.OK)
                .setMessage(DEFAULT_OK)
                .setCurrentTime(new Timestamp(System.currentTimeMillis()));
    }

    public static Result genOkResult(Object data) {
        return new Result()
                .setCode(ResultCode.OK)
                .setMessage(DEFAULT_OK)
                .setData(data)
                .setCurrentTime(new Timestamp(System.currentTimeMillis()));
    }

    public static Result genFailureResult(String message) {
        return new Result()
                .setCode(ResultCode.FAILURE)
                .setMessage(message)
                .setCurrentTime(new Timestamp(System.currentTimeMillis()));
    }
}